<template>
    <div>
        <HeaderS :styleColor="1" />
        <div class="page-content">
            <div class="main-wrap">
                <div :class="$store.getters.screenWidth > 1000 ? 'bread-crumb-box' : 'h5s'">
                    <div class="width-1360">
                        <img src="@/assets/img/home.png" class="home-icon">
                        <span>当前位置：</span>
                        <span>
                            <router-link to="/">&nbsp;首页</router-link>
                            <img src="@/assets/img/right.png" class="left-icon">
                        </span>
                        <span>
                            <span class="now">酒店信息</span>
                        </span>
                    </div>
                </div>
                <div class="main">
                    <div class="title">{{ info.abbr_title }}</div>
                    <div class="line"></div>
                    <div class="summary-wrap">
                        <div v-if="banner.length < 1" class="img-box"
                            :style="{ backgroundImage: 'url(' + info.thumbnail + ')' }">
                        </div>
                        <div v-else class="img-wrap">
                            <div class="swiper-container">
                                <div class="swiper-wrapper">
                                    <div class="swiper-slide" v-for="(item, index) in banner" :key="index">
                                        <div class="img-box" :style="{ backgroundImage: 'url(' + item.url + ')' }">
                                        </div>
                                    </div>
                                </div>
                                <div class="swiper-pagination"></div>

                            </div>
                        </div>
                        <div class="information-wrap">
                            <p class="name">基本信息</p>
                            <div class="nav-wrap">
                                <div class="star">
                                    <p>酒店星级</p>
                                    <p>
                                        {{ info.star }}
                                        <!-- <i class="iconfont l-iconfont"> &#xe605; </i> -->
                                    </p>
                                </div>
                                <div class="price">
                                    <p>人均消费</p>
                                    <p>{{ info.mr_price ? info.mr_price : '未知' }}</p>
                                </div>
                                <div class="phone">
                                    <p>酒店电话</p>
                                    <p>{{ info.phone }} </p>
                                </div>
                            </div>
                            <p class="text">营业时间：{{ info.open_hours }}</p>
                            <p class="text">房间类别：{{ info.room_type }}</p>
                            <p class="text">酒店官网：<span :class="{ have: info.official }" @click="open(info.official)">{{
                                info.official ? info.official : '未知' }}</span></p>
                            <p class="text">酒店地址：{{ info.address }}</p>
                        </div>
                    </div>
                    <div class="content" v-html="info.post_content"></div>
                </div>
            </div>
        </div>
        <FooterS />
    </div>
</template>
<script>
import Swiper from "swiper"
export default ({
    data() {
        return {
            content: '<p>Hello, World!</p>', // 初始内容，可以是富文本HTML字符串
            list: [1, 2, 3, 4],
            swiper: '',
            info: {},
            banner: []
        }
    },
    mounted() {
    },
    created() {
        this.getData(this.$route.query.id)
    },
    methods: {
        open(url) {
            if (url) {
                this.$confirm('', '温馨提示', {
                    message: this.$store.state.cnode,
                    dangerouslyUseHTMLString: true,
                    confirmButtonText: '继续访问',
                    cancelButtonText: '放弃',
                    center: true
                })
                    .then(_ => {
                        window.open(url, '_blank');
                    })
                    .catch(_ => { })
            }
        },
        getSwiper2() {
            this.swiper = new Swiper('.swiper-container', {
                centeredSlides: true,
                loop: true,
                autoplay: {
                    delay: 3000,
                    disableOnInteraction: false,
                },
                pagination: {
                    el: '.swiper-pagination',
                    clickable: true,
                    renderBullet: function (index, className) {
                        return '<span class="' + className + '">' + '</span>';
                    },
                },
            });
        },
        getData(id) {
            this.$api.getHotel({ id }).then((res) => {
                console.log(res);
                if (res.data.code == 1) {
                    this.info = res.data.data.info
                    this.banner = res.data.data.banner
                    this.$nextTick(() => {
                        this.getSwiper2()
                    })
                    this.info.post_content.replace(/<video /g, '<img style="max-width:100%;height:auto;" ');
                    this.info.post_content.replace(/<img /g, '<img style="max-width:100%;height:auto;" ');
                }
            })
        },
    }
})
</script>
<style lang="scss" scoped>
.main-wrap .main .summary-wrap .information-wrap .nav-wrap .star i {
    font-size: 1.04167vw;
}

.main-wrap .main .summary-wrap .information-wrap .text span:hover {
    border-color: #fff;
}

.main-wrap .main .summary-wrap .information-wrap .text .have {
    border-bottom: 1px solid transparent;
}

.bread-crumb-box {
    ::v-deep span {
        a:hover {
            color: #e31c1c;
        }
    }
}

.main-wrap .main .summary-wrap .img-wrap .swiper-pagination {
    ::v-deep .swiper-pagination-bullet {
        width: 0.625vw;
        height: 0.625vw;
        margin: 0 0.26042vw;
        background: #fff;
        opacity: 1;
    }

    ::v-deep .swiper-pagination-bullet-active {
        background-color: #e31c1c;
    }
}

.main-wrap .main .line {
    width: 66.66667vw;
    height: 1px;
    background-color: #eeeeee;
    margin: 1.82292vw auto 2.08333vw;
}

.main-wrap .main .title {
    height: 1.61458vw;
    font-size: 1.5625vw;
    font-weight: 700;
    line-height: 1.61458vw;
    color: #333;
    margin: 0 0 1.77083vw;
    text-align: center;
}

.bread-crumb-box {
    padding: 2.60417vw 0 3.125vw;
}

.main-wrap .main {
    width: 70.83333vw;
    margin: 0 auto;
    background: #fff;
    overflow: hidden;
}

.bread-crumb-box .width-1360 {
    display: -webkit-box;
    display: flex;
    -webkit-box-align: center;
    align-items: center;
}

.width-1360 {
    width: 70.83333vw;
    margin: 0 auto;
}

.main-wrap {
    padding-top: 3.64583vw;
}

.bread-crumb-box .home-icon {
    width: 0.88542vw;
    line-height: 1;
    color: #999;
    margin-right: 0.52083vw;
    display: inline-block;
    vertical-align: middle;
}

.bread-crumb-box span {
    display: inline-block;
    vertical-align: middle;
    font-size: 0.72917vw;
    font-weight: 400;
    color: #666;
    line-height: 0.9375vw;
}

.bread-crumb-box span a {
    color: #666;
}

.bread-crumb-box .left-icon {
    color: #666;
    margin: 0 0.52083vw;
    display: inline-block;
    vertical-align: middle;
}

.bread-crumb-box span:nth-last-of-type(1) {
    color: #333;
}

.bread-crumb-box span .now {
    color: #e31c1c
}

.main-wrap .main .summary-wrap {
    width: 100%;
    display: -webkit-box;
    display: flex;
    -webkit-box-pack: justify;
    justify-content: space-between;
    margin: 0 auto 1.5625vw;
}

.main-wrap .main .summary-wrap .img-box {
    width: 35.15625vw;
    height: 27.08333vw;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
}

.main-wrap .main .summary-wrap .information-wrap {
    width: 35.15625vw;
    height: 27.08333vw;
    padding: 2.08333vw 1.5625vw;
    background: #e31c1c;
    color: #fff;
}

.main-wrap .main .summary-wrap .information-wrap .name {
    font-size: 1.14583vw;
    margin: 0 0 2.08333vw;
}

.main-wrap .main .summary-wrap .information-wrap .nav-wrap {
    display: -webkit-box;
    display: flex;
    margin-bottom: 2.08333vw;
}

.main-wrap .main .summary-wrap .information-wrap .nav-wrap div p:first-child {
    font-size: 0.83333vw;
}

.main-wrap .main .summary-wrap .information-wrap .nav-wrap div p:last-child {
    font-size: 0.72917vw;
}

.main-wrap .main .summary-wrap .information-wrap .nav-wrap .price {
    padding: 0 2.34375vw;
    margin: 0 2.34375vw;
    border-right: 1px solid #e88a8a;
    border-left: 1px solid #e88a8a;
}

.main-wrap .main .summary-wrap .information-wrap .text {
    font-size: 0.83333vw;
    margin-top: 1.04167vw;
}

.main-wrap .main .content {
    padding: 0 0 3.125vw;
}

.main-wrap .main .summary-wrap .img-wrap {
    width: 35.15625vw;
    height: 27.08333vw;
    position: relative;
}

.main-wrap .main .summary-wrap .img-wrap .swiper-pagination {
    position: absolute;
    bottom: 1.04167vw;
    left: 50%;
    -webkit-transform: translateX(-50%);
    transform: translateX(-50%);
}

.main-wrap .main .content {
    padding: 0 2.08333vw 3.125vw;
}

@media(max-width:1000px) {
    .main {
        padding-top: 0;
    }

    .h5s-content {
        min-height: -webkit-calc(100vh - 6rem);
        min-height: calc(100vh - 6rem);
    }

    .h5s {
        font-size: 0;
        padding: 0.5rem 0;
    }

    .h5s .width-1360 {
        width: 100%;
        padding: 0 0.3rem;
        font-size: 0.2rem;
        color: #666;
        display: -webkit-box;
        display: flex;
        -webkit-box-align: center;
        align-items: center;
    }

    .h5s .width-1360 .home-icon {
        width: 0.22rem;
        margin-right: 0.1rem;
    }

    .h5s .width-1360 a {
        color: #666;
    }

    .h5s .width-1360 .left-icon {
        margin: 0 0.1rem;
    }

    .h5s span .now {
        color: #e31c1c
    }

    .main-wrap {
        padding-top: 0;
    }

    .main-wrap .main {
        width: 100%;
        padding: 0 0.3rem;
        margin: 0 auto;
        background: #fff;
        overflow: hidden;
    }

    .main-wrap .main .title {
        font-size: 0.4rem;
        font-weight: 700;
        color: #333;
        margin: 0 0 0.3rem;
        text-align: center;
        height: auto;
        line-height: normal;
    }

    .main-wrap .main .line {
        width: 100%;
        height: 0.01rem;
        background-color: #eee;
        margin: 0.3rem auto 0.4rem;
    }

    .content {
        font-size: 0.2rem;
    }

    .main-wrap .main .summary-wrap {
        width: 100%;
        margin: 0 auto 0.3rem;
        display: block;
    }

    .main-wrap .main .summary-wrap .img-box {
        width: 6.9rem;
        height: 5.3rem;
    }

    .main-wrap .main .summary-wrap .information-wrap {
        width: 6.9rem;
        height: 5.3rem;
        padding: 0.4rem 0.3rem;
        background: #e31c1c;
        color: #fff;
    }

    .main-wrap .main .summary-wrap .information-wrap .name {
        font-size: 0.4rem;
        margin: 0 0 0.4rem;
    }

    .main-wrap .main .summary-wrap .information-wrap .nav-wrap {
        display: -webkit-box;
        display: flex;
        margin-bottom: 0.4rem;
    }

    .main-wrap .main .summary-wrap .information-wrap .nav-wrap div p:first-child {
        font-size: 0.3rem;
    }

    .main-wrap .main .summary-wrap .information-wrap .nav-wrap div p:last-child {
        font-size: 0.2rem;
        margin-top: 0.05rem;
    }

    .main-wrap .main .summary-wrap .information-wrap .nav-wrap .price {
        padding: 0 0.45rem;
        margin: 0 0.45rem;
        border-right: 1px solid #e88a8a;
        border-left: 1px solid #e88a8a;
    }

    .main-wrap .main .summary-wrap .information-wrap .text {
        font-size: 0.2rem;
        margin-top: 0.2rem;
    }

    .main-wrap .main .content {
        padding: 0 0.1rem 0.6rem;
    }

    .main-wrap .main .summary-wrap .img-wrap {
        width: 6.9rem;
        height: 5.3rem;
        position: relative;
    }

    .main-wrap .main .summary-wrap .information-wrap .nav-wrap .star i {
        font-size: 0.1rem;
    }

    .main-wrap .main .summary-wrap .img-wrap .swiper-pagination {
        position: absolute;
        bottom: 0.2rem;
        left: 50%;
        -webkit-transform: translateX(-50%);
        transform: translateX(-50%);
    }

    .main-wrap .main .summary-wrap .img-wrap .swiper-pagination {
        ::v-deep .swiper-pagination-bullet {
            width: 0.12rem;
            height: 0.12rem;
            margin: 0 0.05rem;
            background: #fff;
            opacity: 1;
        }

        ::v-deep .swiper-pagination-bullet-active {
            background-color: #e31c1c;
        }
    }

    .swiper-pagination-bullet-active {
        background: #e31c1c !important;
    }
}
</style>